<div *nzModalTitle> {{ 'mxk.text.select' | i18n }} </div>

<nz-card [nzBordered]="false">
  <form nz-form [nzLayout]="'inline'" (ngSubmit)="onSearch()" class="search__form">
    <div nz-row [nzGutter]="{ xs: 8, sm: 8, md: 8, lg: 24, xl: 48, xxl: 48 }">
      <div nz-col nzMd="12" nzSm="24">
        <nz-form-item>
          <nz-form-label nzFor="name">{{ 'mxk.accountsstrategy.name' | i18n }}</nz-form-label>
          <nz-form-control>
            <input nz-input [(ngModel)]="query.params.name" [ngModelOptions]="{ standalone: true }" name="name" placeholder="" id="name" />
          </nz-form-control>
        </nz-form-item>
      </div>

      <div nz-col [nzSpan]="query.expandForm ? 24 : 12" [class.text-right]="query.expandForm">
        <button nz-button type="submit" [nzType]="'primary'" >{{ 'mxk.text.query' | i18n }}</button>
        <button nz-button type="reset" (click)="onReset()" class="mx-sm" style="display: none">{{ 'mxk.text.reset' | i18n }}</button>
        <button nz-button (click)="query.expandForm = !query.expandForm" class="mx-sm" style="display: none">
          {{ query.expandForm ? ('mxk.text.collapse' | i18n) : ('mxk.text.expand' | i18n) }}</button
        >
        <button nz-button nzType="primary" (click)="onSubmit($event)">{{ 'mxk.text.confirm' | i18n }}</button>
      </div>
    </div>
  </form>
</nz-card>
<nz-card>
  <nz-table
    #dynamicTable
    nzTableLayout="auto"
    nzSize="small"
    nzBordered
    nzShowSizeChanger
    [nzData]="query.results.rows"
    [nzFrontPagination]="false"
    [nzTotal]="query.results.records"
    [nzPageSizeOptions]="query.params.pageSizeOptions"
    [nzPageSize]="query.params.pageSize"
    [nzPageIndex]="query.params.pageNumber"
    [nzLoading]="this.query.tableLoading"
    (nzQueryParams)="onQueryParamsChange($event)"
    nzWidth="100%"
  >
    <thead>
      <tr>
        <th [nzChecked]="query.checked" [nzIndeterminate]="query.indeterminate" (nzCheckedChange)="onTableAllChecked($event)"></th>
        <th nzAlign="center" style="display: none">Id</th>
        <th nzAlign="center">{{ 'mxk.accountsstrategy.name' | i18n }}</th>
        <th nzAlign="center">{{ 'mxk.accountsstrategy.appIcon' | i18n }}</th>
        <th nzAlign="center">{{ 'mxk.accountsstrategy.appName' | i18n }}</th>
        <th nzAlign="center">{{ 'mxk.accountsstrategy.createType' | i18n }}</th>
        <th nzAlign="center">{{ 'mxk.text.status' | i18n }}</th>
        <th nzAlign="center"
          ><a>{{ 'mxk.text.action' | i18n }}</a></th
        >
      </tr>
    </thead>
    <tbody>
      <tr *ngFor="let data of query.results.rows">
        <td
          [nzChecked]="query.tableCheckedId.has(data.id)"
          [nzDisabled]="data.disabled"
          (nzCheckedChange)="onTableItemChecked(data.id, $event)"
        ></td>
        <td nzAlign="left" style="display: none">
          <span>{{ data.id }}</span>
        </td>
        <td nzAlign="center"> {{ data.name }}</td>
        <td nzAlign="center"><img height="30" border="0px" src="{{ data.appIconBase64 }}" /></td>
        <td nzAlign="center"> {{ data.appName }}</td>
        <td nzAlign="left">{{ data.createType == 'manual' ? ('mxk.text.manual' | i18n) : ('mxk.text.manual' | i18n) }}</td>
        <td nzAlign="left">{{ data.status == '1' ? ('mxk.text.status.active' | i18n) : ('mxk.text.inactive' | i18n) }}</td>
      </tr>
    </tbody>
  </nz-table>
</nz-card>
